//
//  ShoppingCarEditVC.m
//  EJLX
//
//  Created by adc on 15/11/24.
//  Copyright © 2015年 江苏一键联信息科技有限公司. All rights reserved.
//

#import "ShoppingCarEditVC.h"
#import "shoppingTableViewCell.h"
#import "ShoppingVC.h"
@interface ShoppingCarEditVC ()

@end

@implementation ShoppingCarEditVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBarHidden = YES;
    _selectArray = [NSMutableArray array];
 
    _string=[NSMutableString string];
    _selectItemID = [NSMutableString string];
    [self creatNav];
    [_tableviewCar registerNib:[UINib nibWithNibName:@"shoppingTableViewCell" bundle:nil] forCellReuseIdentifier:@"cell"];
    [_tableviewCar setSeparatorColor:[UIColor blackColor]];
    [_tableviewCar setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine];
    if ([_tableviewCar respondsToSelector:@selector(setLayoutMargins:)]) {
        [_tableviewCar setLayoutMargins:UIEdgeInsetsZero];
    }
    if ([_tableviewCar respondsToSelector:@selector(setSeparatorInset:)]) {
        [_tableviewCar setSeparatorInset:UIEdgeInsetsZero];
    }
    

    
    [_tableviewCar reloadData];

}
-(void)creatNav{
    
    UIView *navView = [[UIView alloc] initWithFrame:CGRectMake(0, 20, WIDE, 44)];
    navView.backgroundColor = RGB_COLOR(0x00c49f);
    [self.view addSubview:navView];
    
    UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    leftBtn.frame = CGRectMake(10, 7, 30, 30);
    leftBtn.layer.cornerRadius = 20;
    [leftBtn setImage:[UIImage imageNamed:@"返回箭头"] forState:UIControlStateNormal] ;
    [leftBtn addTarget:self action:@selector(backBtn) forControlEvents:UIControlEventTouchUpInside];
    [navView addSubview:leftBtn];
    
    UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(WIDE/2-60, 7, 120, 30  )];
    title.text = @"购物车";
    title.textAlignment = NSTextAlignmentCenter;
    title.textColor = [UIColor whiteColor];
    [navView addSubview:title];
    
    UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    rightBtn.frame = CGRectMake(WIDE-50, 7, 40, 30);
    rightBtn.layer.cornerRadius = 20;
    rightBtn.titleLabel.textAlignment = NSTextAlignmentCenter;
    [rightBtn setTitle:@"完成" forState:UIControlStateNormal] ;
    [rightBtn addTarget:self action:@selector(rightBtn) forControlEvents:UIControlEventTouchUpInside];
    [navView addSubview:rightBtn];
   
    if (self.shop) {
        for (int i = 0; i <self.shop.sectionArr.count; i++) {
            NSMutableDictionary *sectionDict = [NSMutableDictionary dictionary];
            NSMutableDictionary *rowDict = [NSMutableDictionary dictionary];
            [sectionDict setObject:@"NO" forKey:[NSString stringWithFormat:@"%dsection_isSelect",i ]];
            
            CarSection *sectionGoods = self.shop.sectionArr[i];
            
            for (int a =0 ; a<sectionGoods.itemsArr.count;a++) {
                [rowDict setObject:@"NO" forKey:[NSString stringWithFormat:@"%dsection_%drow",i ,a]];
            }
            [sectionDict setObject:rowDict forKey:[NSString stringWithFormat:@"%dsection",i]];
            [_selectArray addObject:sectionDict];
        }
        

    }
}

-(void)backBtn{
    [self.navigationController popViewControllerAnimated:YES];
}



-(void)rightBtn{
    //over
     [self.navigationController popViewControllerAnimated:YES];
    
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return self.shop.sectionArr.count;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
   
    if (_tableviewCar.dataSource == 0) {
        _tableviewCar.separatorStyle = UITableViewCellSeparatorStyleNone;
    }
    CarSection *sectionGoods = self.shop.sectionArr[section];
   
     return sectionGoods.itemsArr.count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 94;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 40;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 40;
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    shoppingTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"gowuche3"];
    if (!cell) {
        cell= [[NSBundle mainBundle] loadNibNamed:@"shoppingTableViewCell" owner:nil options:nil][2];
     
    }
    CarSection *sectionGoods = self.shop.sectionArr[indexPath.section];
    ShoppingCarItem *item = sectionGoods.itemsArr[indexPath.row];
    
    cell.cell3NumLB.text =[NSString stringWithFormat:@"%d",item.count];
    [cell.cell3Image sd_setImageWithURL:[NSURL URLWithString:item.image]];
    if (![item.desc length]) {
        cell.cell3JieShaoLB.text = [NSString stringWithFormat:@"商品规格:无"];
    }else{
    cell.cell3JieShaoLB.text =[NSString stringWithFormat:@"商品规格:%@",item.desc];
    }
 
    cell.cell3Btn.tag = indexPath.row;
    NSMutableDictionary *sectionDict = [_selectArray[indexPath.section] objectForKey:[NSString stringWithFormat:@"%dsection",(int)indexPath.section]];
    NSString * isSeclect = [_selectArray[indexPath.section] objectForKey:[NSString stringWithFormat:@"%dsection_isSelect",(int)indexPath.section]];
    
    NSLog(@"item row  %d",item.itemId);
    NSLog(@"se   %@",isSeclect);
    if ([isSeclect isEqualToString:@"NO"]) {
        for (int i = 0; i <sectionDict.allKeys.count; i++) {
            
            [sectionDict setObject:@"NO" forKey:[NSString stringWithFormat:@"%dsection_%drow",(int)indexPath.section,(int)indexPath.row]];
            
        }
    }else{
        for (int i = 0; i <sectionDict.allKeys.count; i++) {
            [sectionDict setObject:@"YES" forKey:[NSString stringWithFormat:@"%dsection_%drow",(int)indexPath.section,(int)indexPath.row]];
            
        }
        
    }
    
    
    if ([[sectionDict objectForKey:[NSString stringWithFormat:@"%dsection_%drow",(int )indexPath.section,(int)indexPath.row]] isEqualToString:@"YES"]) {
        [cell.cell3Btn setImage:[UIImage imageNamed:@"购物车选中"] forState:UIControlStateNormal];
        
    }else{
        [cell.cell3Btn setImage:[UIImage imageNamed:@"购物车未选择"] forState:UIControlStateNormal];
        
    }

    [cell.cell3Btn addTarget:self action:@selector(selectBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    [cell.cell3AddBtn addTarget:self action:@selector(addBtn:) forControlEvents:UIControlEventTouchUpInside];
    [cell.cell3JianBtn addTarget:self action:@selector(jianBtn:) forControlEvents:UIControlEventTouchUpInside];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:UIEdgeInsetsZero];
    }
    if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
        [cell setSeparatorInset:UIEdgeInsetsZero];
    }
    
  

    return cell;
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    CarSection *sectionCar = [self.shop.sectionArr objectAtIndex:section];
  
   
    UIView *vc = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WIDE, 30)];
    vc.backgroundColor = [UIColor whiteColor];
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = CGRectMake(5, 9, 25, 25);
    NSString *  isSeclect = [_selectArray[section] objectForKey:[NSString stringWithFormat:@"%dsection_isSelect",(int)section]];
    
    if ([isSeclect isEqualToString:@"YES"]) {
        [btn setImage:[UIImage imageNamed:@"购物车选中"] forState:UIControlStateNormal ];
    }else {
        
        [btn setImage:[UIImage imageNamed:@"购物车未选择"] forState:UIControlStateNormal];
    }

    btn.tag = 1000+section;

 
    [btn addTarget:self action:@selector(selectHeaderBtn:) forControlEvents:UIControlEventTouchUpInside];
    [vc addSubview:btn];
    
    UIImageView *img = [[UIImageView alloc] initWithFrame:CGRectMake(40, 7, 30, 30)];
    [img sd_setImageWithURL:[NSURL URLWithString:sectionCar.shopImage]];
    
    [vc addSubview:img];
    UILabel *titleLB = [[UILabel alloc] initWithFrame:CGRectMake(75, 7, WIDE - 100, 30 )];

    titleLB.text = sectionCar.shopName;
    NSLog(@"title %@",sectionCar.shopName);
    titleLB.textColor = [UIColor blackColor];
    [vc addSubview:titleLB];
    
    return vc;
}
//-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
//    UIView *vc = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WIDE, 30)];
//    vc.backgroundColor = [UIColor whiteColor];
//    
//    UILabel *titleLB = [[UILabel alloc] initWithFrame:CGRectMake(60, 5, WIDE - 100, 20 )];
//    titleLB.text = @"再买包邮";
//    [vc addSubview:titleLB];
//    
//    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
//    btn.frame = CGRectMake(WIDE-100, 5, 80, 20);
//    [btn setTitle:@"去凑单>" forState:UIControlStateNormal];
//    [btn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
//    [btn addTarget:self action:@selector(goCouDan) forControlEvents:UIControlEventTouchUpInside];
//    [vc addSubview:btn];
//    
//    return vc;
//}
-(void)selectHeaderBtn:(UIButton *)btn{
    btn.selected = !btn.selected;
    NSMutableDictionary *sectionDict = [_selectArray[btn.tag-1000] objectForKey:[NSString stringWithFormat:@"%dsection",(int)btn.tag - 1000]];
    NSString *  isSeclect = [_selectArray[btn.tag-1000] objectForKey:[NSString stringWithFormat:@"%dsection_isSelect",(int)btn.tag-1000]];
    if ([isSeclect isEqualToString:@"NO"]) {
        //   btn.selected = YES;
        
        [_selectArray[btn.tag -1000] setObject:@"YES" forKey:[NSString stringWithFormat:@"%dsection_isSelect",(int)btn.tag-1000]];
        for (int i = 0; i <sectionDict.allKeys.count; i ++) {
            
            [sectionDict setObject:@"YES" forKey:[NSString stringWithFormat:@"%dsection_%drow",(int)btn.tag-1000,i]];
        }
        // [btn setImage:[UIImage imageNamed:@"购物车选中"] forState:UIControlStateSelected];
    }else {
        
        [_selectArray[btn.tag -1000] setObject:@"NO" forKey:[NSString stringWithFormat:@"%dsection_isSelect",(int)btn.tag-1000]];
        for (int i = 0; i < sectionDict.allKeys.count; i++) {
            
            [sectionDict setObject:@"NO" forKey:[NSString stringWithFormat:@"%dsection_%drow",(int)btn.tag - 1000,i]];
            
        }
        //    btn.selected = NO;
        //    [btn setImage:[UIImage imageNamed:@"购物车未选择"] forState:UIControlStateNormal];
    }
    
    
    
    NSLog(@"_header %@\n",_selectArray);
    
    [_tableviewCar reloadData];
}
-(void)selectBtnClick:(UIButton *)btn{
   // btn.selected = !btn.selected ;
    UITableViewCell *cell = (UITableViewCell *)[[btn superview ]superview] ;
    
    NSIndexPath *index = [_tableviewCar indexPathForCell:cell ];
    
   //  ShoppingCarItem *item = [self.shop.itemsArr objectAtIndex:index.row];
   // NSLog(@"tag %ld  index %ld row %ld",btn.tag,index.section ,index.row);
    NSMutableDictionary *sectionDict = [_selectArray[index.section] objectForKey:[NSString stringWithFormat:@"%dsection",(int)index.section]];
    // NSString *  isSeclect = [_selectArray[index.section] objectForKey:[NSString stringWithFormat:@"%dsection_isSelect",(int)index.section]];
    if ([[sectionDict objectForKey:[NSString stringWithFormat:@"%dsection_%drow",(int)index.section,(int)index.row]] isEqualToString:@"YES"]) {
        btn.selected = NO;
        [btn setImage:[UIImage imageNamed:@"购物车未选择"] forState:UIControlStateNormal];
        [sectionDict setObject:@"NO" forKey:[NSString stringWithFormat:@"%dsection_%drow",(int)index.section,(int)index.row]];
        
    }
    else{
        btn.selected = YES;
        [btn setImage:[UIImage imageNamed:@"购物车选中"] forState:UIControlStateSelected];
        [sectionDict setObject:@"YES" forKey:[NSString stringWithFormat:@"%ldsection_%ldrow",index.section,index.row]];
  //   [_selectItemID insertString:[NSString stringWithFormat:@"%d,",item.itemId] atIndex:index.row];
    }
    
 
    //UITableViewCell * top_cell =  [_tableViewShopping cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:index.section]];
    UIButton * button =(UIButton *)[_tableviewCar viewWithTag:(index.section+1000)];
    NSMutableDictionary * rowDictionary =[NSMutableDictionary dictionary];
    CarSection *sectionGoods = self.shop.sectionArr[index.section];
       for (int i = 0; i< sectionGoods.itemsArr.count; i++) {
        [rowDictionary setObject:@"YES" forKey:[NSString stringWithFormat:@"%dsection_%drow",(int)index.section,i]];
    }
    
    if ([sectionDict isEqualToDictionary:rowDictionary]) {
        [_selectArray[index.section] setObject:@"YES" forKey:[NSString stringWithFormat:@"%dsection_isSelect",(int)index.section]];
        button.selected = YES;
        [button setImage:[UIImage imageNamed:@"购物车选中"] forState:UIControlStateSelected];
    }else{
        button.selected = NO;
        [button setImage:[UIImage imageNamed:@"购物车未选择"] forState:UIControlStateNormal];
    }
    NSLog(@"_SE %@\n",_selectArray);
    
   
}
-(void)goCouDan{
    //凑单
    ShoppingVC *shop = [[ShoppingVC alloc] init];
    [self.navigationController pushViewController:shop animated:YES];
    
}
- (IBAction)deleteGoodsBtn:(id)sender {
    _groupsArray = [NSMutableArray array];
    _itemsArray = [NSMutableArray array];
    

    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
    dispatch_async(queue, ^{
       
        for (int x= 0; x<_selectArray.count; x++) {
            NSDictionary *sectionDict = _selectArray[x];
            
              CarSection *sectionCar = [self.shop.sectionArr objectAtIndex:x];
             NSString *sectionSelected = [NSString stringWithFormat:@"%dsection_isSelect",x];
            if ([sectionDict[sectionSelected] isEqualToString:@"YES"]) {
             
                
                 [_groupsArray addObject:sectionCar.groupId];
                [self.shop.sectionArr removeObjectAtIndex:x];
                NSString *sectionKey = [NSString stringWithFormat:@"%dsection",x];
                NSMutableDictionary  *rowsDict = sectionDict[sectionKey];
                for (int y = 0; y<rowsDict.allKeys.count; y++) {
           //         CarSection *sectionGoods = self.shop.sectionArr[x];
                    ShoppingCarItem *item = sectionCar.itemsArr[y];
                    
                    if (item.itemId) {
                        
              [_itemsArray addObject:[NSString stringWithFormat:@"%d",item.itemId]];
            [sectionCar.itemsArr removeObjectAtIndex:y];
           [rowsDict  removeObjectForKey:[NSString stringWithFormat:@"%dsection_%drow",x,y]];

                    }
                    
                }
            

                
            }else{
                
               
                NSString *sectionKey = [NSString stringWithFormat:@"%dsection",x];

                NSMutableDictionary  *rowsDict = sectionDict[sectionKey];
               //  CarSection *sectionCar = [self.shop.sectionArr objectAtIndex:x];
               
                for (int y = 0; y<rowsDict.allKeys.count; y++) {
                    NSString * rowKey = [NSString stringWithFormat:@"%dsection_%drow",x,y];
                    if ([rowsDict[rowKey]isEqualToString:@"YES"]) {

                        ShoppingCarItem *item = sectionCar.itemsArr[y];
                   [_itemsArray addObject:[NSNumber numberWithInt:item.itemId]];
                      
                        [sectionCar.itemsArr removeObjectAtIndex:y];
                        
                     [rowsDict  removeObjectForKey:[NSString stringWithFormat:@"%dsection_%drow",x,y]];

                        
                    }
                    
                }
                
               }
            
        }
       
        dispatch_async(dispatch_get_main_queue(), ^{
            
            [HttpsManager deleteCarWithGroups:_groupsArray itemsArray:_itemsArray completion:^(NSString *errmsg) {
                NSLog(@"err %@",errmsg);
                [_itemsArray removeAllObjects];
                [_groupsArray removeAllObjects];
            }];
        });

    });
  
  
        [_tableviewCar reloadData];
  
   
}

- (IBAction)removeToShouCangJiaBtn:(id)sender {
  
    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
    dispatch_async(queue, ^{
        
        for (int x= 0; x<_selectArray.count; x++) {
            NSDictionary *sectionDict = _selectArray[x];
            CarSection *sectionCar = [self.shop.sectionArr objectAtIndex:x];
            
            
            NSString *sectionSelected = [NSString stringWithFormat:@"%dsection_isSelect",x];
            if ([sectionDict[sectionSelected] isEqualToString:@"YES"]) {
                
               [self.shop.sectionArr removeObjectAtIndex:x];
                
                NSString *sectionKey = [NSString stringWithFormat:@"%dsection",x];
                NSMutableDictionary  *rowsDict = sectionDict[sectionKey];
                for (int y = 0; y<rowsDict.allKeys.count; y++) {
                    ShoppingCarItem *item = sectionCar.itemsArr[y];
                    
                    if (item.itemId) {
                        
                        [rowsDict  removeObjectForKey:[NSString stringWithFormat:@"%dsection_%drow",x,y]];
                        [_string appendString:[NSString stringWithFormat:@"%d,",item.itemId]];
                    }
                    
                }
                if (rowsDict.allKeys.count ==0) {
                    [_selectArray removeObject:sectionDict];
                    
                }
                
            }else{
                
                
                NSString *sectionKey = [NSString stringWithFormat:@"%dsection",x];
                
                NSMutableDictionary  *rowsDict = sectionDict[sectionKey];
                for (int y = 0; y<rowsDict.allKeys.count; y++) {
                    NSString * rowKey = [NSString stringWithFormat:@"%dsection_%drow",x,y];
                    if ([rowsDict[rowKey]isEqualToString:@"YES"]) {
                        
                        ShoppingCarItem *item = sectionCar.itemsArr[y];
                    
                        [_string appendString:[NSString stringWithFormat:@"%d,",item.itemId]];
                        [sectionCar.itemsArr removeObjectAtIndex:y];
                        
                        [rowsDict  removeObjectForKey:[NSString stringWithFormat:@"%dsection_%drow",x,y]];
                        
                        
                    }
                    
                }
                
            }
            
        }
        
        dispatch_async(dispatch_get_main_queue(), ^{
            if ([_string length]) {
                [_string deleteCharactersInRange:NSMakeRange(_string.length-1, 1)];
                NSLog(@"++++++++++++++ %@",_string);
                [HttpsManager addGoodsToShouCangJiaItemID:_string completion:^(NSString *errmsg) {
                    SHOW_ALERT(errmsg);
                    [GMDCircleLoader hideFromView:self.view animated:YES];
                    [_tableviewCar reloadData];
                }];

            }else{
                SHOW_ALERT(@"war!")
            }
         });
        
    });
    
}

- (IBAction)selectAllGoodsBtn:(id)sender {
    UIButton *btn = (UIButton *)sender;
    btn.selected = !btn.selected;
    
    for (int a = 0; a <self.shop.sectionArr.count; a++) {
        
        NSMutableDictionary *sectionDict = _selectArray[a];
        if (btn.selected) {
            //            _isBtnSelectAll = YES;
            //            _isSectionBtn = YES;
            [sectionDict setObject:@"YES" forKey:[NSString stringWithFormat:@"%dsection_isSelect",a ]];
            NSMutableDictionary *rowDict = [sectionDict objectForKey:[NSString stringWithFormat:@"%dsection",a ]];
            for (int i = 0; i <sectionDict.allKeys.count; i ++) {
                
                [rowDict setObject:@"YES" forKey:[NSString stringWithFormat:@"%dsection_%drow",a ,i]];
                
            }
            btn.selected = YES;
            [btn setImage:[UIImage imageNamed:@"购物车选中"] forState:UIControlStateSelected];
        }else {
           
            [sectionDict setObject:@"NO" forKey:[NSString stringWithFormat:@"%dsection_isSelect",a ]];
            NSMutableDictionary *rowDict = [sectionDict objectForKey:[NSString stringWithFormat:@"%dsection",a ]];
            for (int i = 0; i < sectionDict.allKeys.count; i++) {
                
                [rowDict setObject:@"NO" forKey:[NSString stringWithFormat:@"%dsection_%drow",a,i]];
                
            }
            btn.selected =NO;
            [btn setImage:[UIImage imageNamed:@"购物车未选择"] forState:UIControlStateNormal];
        }
        
        
    }
    
    [_tableviewCar reloadData];
}


-(void)addBtn:(UIButton *)btn{
    
    
    UITableViewCell *cell =(UITableViewCell *) [[[btn superview] superview]superview];
    NSIndexPath *indexPath = [_tableviewCar indexPathForCell:cell];
    CarSection *sectionGoods = self.shop.sectionArr[indexPath.section];
    ShoppingCarItem *item = sectionGoods.itemsArr[indexPath.row];
  
    item.count = item.count +1;
    

    [HttpsManager addNumberItemID:[NSString stringWithFormat:@"%d", item.itemId] num:[NSString stringWithFormat:@"%d", item.count] completion:^(NSString *errmsg) {
        
    }];
  
    [_tableviewCar reloadData];
}
-(void)jianBtn:(UIButton *)btn{
    UITableViewCell *cell =(UITableViewCell *) [[btn superview] superview] ;
    NSIndexPath *indexPath = [_tableviewCar indexPathForCell:cell];
    CarSection *sectionGoods = self.shop.sectionArr[indexPath.section];
    ShoppingCarItem *item = sectionGoods.itemsArr[indexPath.row];
     if (item.count>0) {
         item.count = item.count -1;
        
        
           }
    if (item.count == 0) {
        [sectionGoods.itemsArr removeObjectAtIndex:indexPath.row];
        
    }

    [HttpsManager addNumberItemID:[NSString stringWithFormat:@"%d", item.itemId] num:[NSString stringWithFormat:@"%d", item.count] completion:^(NSString *errmsg) {
        
    }];
    
    [_tableviewCar reloadData];
   
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];



}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
